home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / include / user / cfuncproto.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-05  |  1.9 KB  |  83 lines

  1. /*
  2.  * cfuncproto.h --
  3.  *
  4.  *    Declarations of a macro supporting Ansi-C function prototypes in
  5.  *    Sprite. This macro allow function prototypes to be defined 
  6.  *    such that the code works on both standard and K&R C.
  7.  *
  8.  * Copyright 1990 Regents of the University of California
  9.  * Permission to use, copy, modify, and distribute this
  10.  * software and its documentation for any purpose and without
  11.  * fee is hereby granted, provided that the above copyright
  12.  * notice appear in all copies.  The University of California
  13.  * makes no representations about the suitability of this
  14.  * software for any purpose.  It is provided "as is" without
  15.  * express or implied warranty.
  16.  *
  17.  * $Header: /user5/kupfer/spriteserver/include/user/RCS/cfuncproto.h,v 1.4 91/12/12 22:27:01 kupfer Exp $ SPRITE (Berkeley)
  18.  */
  19.  
  20. #ifndef _CFUNCPROTO
  21. #define _CFUNCPROTO
  22.  
  23. /*
  24.  * Definition of the _ARGS_ macro.  The _ARGS_ macro such be used to 
  25.  * enclose the argument list of a function prototype.  For example, the
  26.  * function:
  27.  * extern int main(argc, argv)
  28.  *    int args;
  29.  *     char **argv;
  30.  *
  31.  * Would have a prototype of:
  32.  *
  33.  * extern int main _ARGS_((int argc, char **argv))
  34.  *
  35.  * Currently the macro uses the arguments only when compiling the
  36.  * KERNEL or Sprite server with a standard C compiler.
  37.  */
  38.  
  39. #ifndef _ASM
  40.  
  41. #if (defined(KERNEL) || defined(SPRITED)) && defined(__STDC__)
  42. #define _HAS_PROTOTYPES
  43. #define _HAS_VOIDPTR
  44. #endif
  45.  
  46. #ifdef lint
  47. #undef _HAS_CONST
  48. #undef _HAS_VOIDPTR
  49. #endif
  50.  
  51. #if defined(__cplusplus)
  52. #define _EXTERN         extern "C"
  53. #define _NULLARGS    (void) 
  54. #define _HAS_PROTOTYPES
  55. #define _HAS_VOIDPTR
  56. #define _HAS_CONST
  57. #else 
  58. #define _EXTERN         extern
  59. #define _NULLARGS    () 
  60. #endif
  61.  
  62. #if defined(_HAS_PROTOTYPES) && !defined(lint)
  63. #define    _ARGS_(x)    x
  64. #else
  65. #define    _ARGS_(x)    ()
  66. #endif
  67.  
  68. #ifdef _HAS_CONST
  69. #define _CONST          const
  70. #else
  71. #define _CONST
  72. #endif
  73.  
  74. #ifdef _HAS_VOIDPTR
  75. typedef void *_VoidPtr;
  76. #else
  77. typedef char *_VoidPtr;
  78. #endif
  79.  
  80. #endif /* _ASM */
  81. #endif /* _CFUNCPROTO */
  82.  
  83.